// class multiRectangle - hold a set o retangle and compute geometric
// properties

#pragma once

#include <vector>
#include "rectangle.h"


using namespace std;

//
//////////////////////////////////////////////////////////////////////////
class multiRectangle
{
public:
  multiRectangle(void);
  ~multiRectangle(void);

  void pushRetangle (rectangle &rec)
  {
    rectangles.push_back(rec);
  }

  void pushRetangle (double xmn, double ymn, double xmx, double ymx, double rot = 0.0)
  {
    rectangle rec;
    rec.setCoords(xmn, ymn, xmx, ymx, rot);
    rectangles.push_back(rec);
  }

  void computeProperties ( );

  double getArea ( ) { return m_Area; }
  double getIx   ( ) { return m_Ix; }
  double getIy   ( ) { return m_Iy; }
  double getCx   ( ) { return m_Cx; }
  double getCy   ( ) { return m_Cy; }

  double getMaxX ( );
  double getMaxY ( );

  //
  double getCrossMinimunWidth (double _ref);

  // get static moment
  double getStaticMoment (double _ref);

  // read file with coordinates 
  int read (char *fn);

  void drawMatlab (char *fn);


private:
  vector <rectangle> rectangles;

  double m_Area, m_Cx, m_Cy, m_Ix, m_Iy;
};
